<#include "/client/config.ftl"/>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no" />
		<title>患者任务一览</title>
		<link rel="stylesheet" href="${base}/css/bootstrap.min.css" />
		<script type="text/javascript" src="${base}/js/jquery-1.12.0.min.js"></script>
		<link rel="stylesheet" href="${base}/css/common.css" />
	</head>

	<body>
		<div class="container-fluid">
			
			<form action="${base}/web/info/queryByUser" id="form">
			
			<select id="status" name="status" class="form-control mar_top">
				<#if status == 0>
					<option value="0" selected>未完成</option>
				<#else>
					<option value="0">未完成</option>
				</#if>
				<#if status == 2>
					<option value="2" selected>已完成</option>
				<#else>
					<option value="2">已完成</option>
				</#if>
				<#if status == 1>
					<option value="1" selected>过期未完成</option>
				<#else>
					<option value="1">过期未完成</option>
				</#if>
			</select>
			<div class="hidden_area">
				<input type="hidden" id="current" name="current" value="${current}"/>
				<input type="hidden" id="pages" value="${pages}"/>
				<input type="hidden" name="groupId" value="${groupId}"/>
				<input type="hidden" name="userId" value="${userId}"/>
			</div>
			</form>
			<ul id="task_list" class="mar_top">
				<#list tasks as ts>
					<li class="list_each">
						<div class="item">
							<#if ts.tsType == 1>
								<span class="key">疼痛评估任务</span>
							<#elseif ts.tsType == 2>
								<span class="key">不良反应反馈任务</span>
							<#elseif ts.tsType == 3>
								<span class="key">依从性评价任务</span>
							<#elseif ts.tsType == 4>
								<span class="key">健康评估任务</span>
							<#elseif ts.tsType == 5>
								<span class="key">滴定任务</span>
							<#else>
								<span class="key">服药提醒任务</span>
							</#if>
							<span class="value">${ts.strDate}</span>
						</div>
					</li>
				</#list>
			</ul>
			<ul class="pagination page_right">
  				<li><a href="#" onclick="pageChange(0)">&laquo;</a></li>
  				<li><a href="#" onclick="pageChange(1)">&raquo;</a></li>
			</ul>
		</div>
		<script>
			var sta = $("#status");
			var current = $("#current");
			var pages = $("#pages");
			var form = $("#form");
			sta.change(function(){
				current.val("1");
				form.submit();
			});
			function pageChange(num){
				var total = pages.val();
				var now = current.val();
				if(num == 0){
					if(now == 1){
						alert("当前已经是第一页");
					}else{
						var nowNum = parseInt(now);
						nowNum = nowNum - 1;
						current.val(nowNum);
						form.submit();
					}
				}else{
					if(now == total){
						alert("当前已经是最后一页");
					}else{
						var nowNum = parseInt(now);
						nowNum = nowNum + 1;
						current.val(nowNum);
						form.submit();
					}
				}
			}
		</script>
	</body>

</html>